from Base.base import Base
from selenium.webdriver.common.by import By
from utils.data_header import read_yaml
import os

class Page5(Base):
    # 获取定位信息
    current_dir = os.path.dirname(__file__)
    test_case = read_yaml(os.path.join(current_dir, '..', 'Config', 'endpoints.yaml'))
    case = test_case[4]

    manage_loc=(By.XPATH,case['manage_loc'])

    def manage(self):
        self.click(self.manage_loc)

    productlist_loc=(By.XPATH,case['productlist_loc'])

    def productlist(self):
        self.click(self.productlist_loc)

    setpayway1_loc = (By.XPATH, case['setpayway1_loc'])

    def setpayway1(self):
        self.click(self.setpayway1_loc)

    setpayway2_loc = (By.XPATH, case['setpayway2_loc'])

    def setpayway2(self):
        self.click(self.setpayway2_loc)

    setzfb_loc = (By.ID, case['setzfb_loc'])

    def setzfb(self):
        self.select(self.setzfb_loc,'支付宝')

    setzfb2_loc = (By.ID, case['setzfb2_loc'])

    def setzfb2(self):
        self.select(self.setzfb2_loc,'支付宝测试')

    setzfhl_loc = (By.XPATH, case['setzfhl_loc'])

    def setzfhl(self,paytype):
        self.send_keys(self.setzfhl_loc,paytype)

    submit2_loc = (By.XPATH, case['submit2_loc'])

    def submit(self):
        self.click(self.submit2_loc)

    shangjia_loc = (By.XPATH, case['shangjia_loc'])

    def shangjia(self):
        self.click(self.shangjia)

    queding_loc = (By.XPATH, case['queding_loc'])

    def queding(self):
        self.click(self.queding_loc)

    delete_loc = (By.XPATH, case['delete_loc'])

    def delete(self):
        self.click(self.delete_loc)

    queren_loc = (By.XPATH, case['queren_loc'])

    def queren(self):
        self.click(self.queren_loc)